package com.hzcx.app.simplechat.ui.user;

import android.view.KeyEvent;

import androidx.fragment.app.FragmentTransaction;

import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.base.BaseActivity;
import com.hzcx.app.simplechat.ui.moment.fragment.UserMomentFragment;

/**
 * 用户朋友圈
 */
public class UserMomentActivity extends BaseActivity {

    public static final String INTENT_USER_INFO = "INTENT_USER_INFO";

    private UserMomentFragment momentFragment;

    @Override
    public int getLayout() {
        return R.layout.activity_user_moment;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {

        // TODO: 2020/8/26 直接用activity的话，不知道为啥顶部会有标题栏的间距，具体原因不知，所以先用fragment填充
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        momentFragment = new UserMomentFragment();
        momentFragment.setArguments(getIntent().getExtras());
        transaction.add(R.id.frame_layout, momentFragment);
        transaction.commit();
    }

    @Override
    public void initData() {
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (momentFragment != null) {
            if (momentFragment.imageViewer != null) {
                boolean b = momentFragment.imageViewer.onKeyDown(keyCode, event);
                if (b) {
                    return b;
                }
            }
        }
        return super.onKeyDown(keyCode, event);
    }
}
